import {url} from './index';
import axios from 'axios';

export const  getOrder = async () => {
    let result = await axios({
        method:'get',
        url:url+'/order',
        params:{}
    })
    // console.log(result.data);
    return result.data;
}

export const  deleteOrder = async (_id) => {
    let result = await axios({
        method:'delete',
        url:url+'/order/'+_id,
    })
    return result.data;
}
// export const  addOrder = async (data) => {
//     let result = await axios({
//         method:'post',
//         url:url+'/order',
//         data
//     })
//     return result.data;
// }

// 搜索参数{type,value}
export const  searchOrder = async (data) => {
    let result = await axios({
        method:'get',
        url:url+'/order',
        params:data
    })
    return result.data;
}

export const  updateOrder = async (data) => {
    let result = await axios({
        method:'put',
        url:url+`/order/${data._id}`,
        data
    })
    return result.data;
}